package day_240607;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;

public class TicketWindowProblem {
    static Queue<String> tickets = new ConcurrentLinkedQueue<>();

    static {
        for (int i = 0; i < 10000; i++) {
            tickets.add(" 车票号 " + i);
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            new Thread(() -> {
                while(true) {
                    String s = tickets.poll();
                    if(s == null) {
                        break;
                    }
                    else System.out.println("售出===" + s);
                }
            }).start();
        }
    }
}
